<template>
  <a-card :bordered="false">
    <!-- 查询区域 -->
    <div class="table-page-search-wrapper">
      <a-form layout="inline" @keyup.enter.native="searchQuery">
        <a-row :gutter="24">
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="单据编号">
              <j-input placeholder="请输入单据编号" v-model="queryParam.purchaseBill"></j-input>
            </a-form-item>
          </a-col>
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item
              label="项目名称"
              :wrapperCol="{
                xs: { span: 24 },
                sm: { span: 12 },
              }"
            >
              <select-project-input  v-model="queryParam.projectId" placeholder="请选择项目名称"/>
            </a-form-item>
          </a-col>
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item
              label="申请人"
              :wrapperCol="{
                xs: { span: 24 },
                sm: { span: 12 },
              }"
            >
              <select-user-by-dep
                placeholder="请选择申请人"
                v-model="queryParam.employeeId"
              />
            </a-form-item>
          </a-col>
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
              <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
              <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
            </span>
          </a-col>
        </a-row>
      </a-form>
    </div>
    <!-- 查询区域-END -->
    <!-- 操作按钮区域 -->
    <!-- <div class="table-operator">
      <a-button type="primary" icon="download" @click="handleExportXls('定标意见单')" :disabled="isDisabledAuth('erpPurchaseCalibrationOpinion:export')">导出</a-button>
    </div> -->
    <!-- table区域-begin -->
    <div>
      <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
        <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项
        <a style="margin-left: 24px" @click="onClearSelected">清空</a>
      </div>

      <a-table
        ref="table"
        size="middle"
        :scroll="{x:scrollX}"
        :components="draggableComponent"
        bordered
        rowKey="id"
        :columns="columns"
        :dataSource="dataSource"
        :pagination="ipagination"
        :loading="loading"
        :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
        class="j-table-force-nowrap"
        :customRow="customRow"
        @change="handleTableChange">
        <a slot="purchaseBill" slot-scope="text, record" @click="getDetail(record.id)">{{ text }}</a>
      </a-table>
    </div>
  </a-card>
</template>

<script>

  import '@/assets/less/TableExpand.less'
  import { mixinDevice } from '@/utils/mixin'
  import {JeecgBpmListMixin} from '@/mixins/JeecgBpmListMixin'
  import {DisabledAuthFilterMixin} from '@/mixins/DisabledAuthFilterMixin'
  import SelectProjectInput from '@/views/scy/components/SelectProjectInput'
  import SelectUserByDep from '@/views/scy/components/SelectUserByDep'

  export default {
    name: 'ErpPurchaseCalibrationList',
    mixins:[JeecgBpmListMixin, mixinDevice, DisabledAuthFilterMixin],
    components: {
      SelectProjectInput,
      SelectUserByDep
    },
    data () {
      return {
        description: '定标意见清单',
        //表头
        columns:[],
        //列设置
        // 列定义
        defColumns: [
          {
            title: '序号',
            dataIndex: '',
            key:'rowIndex',
            width:60,
            align:"center",
            customRender:function (t,r,index) {
              return parseInt(index)+1;
            }
          },
          {
            title:'单据编号',
            align:"center",
            width:200,
            ellipsis: true,
            dataIndex: 'purchaseBill',
            scopedSlots: { customRender: 'purchaseBill' },
          },
          {
            title:'申请人',
            align:"center",
            width:100,
            ellipsis: true,
            dataIndex: 'employeeId_dictText',
          },
          {
            title:'申请部门',
            align:"center",
            width:100,
            ellipsis: true,
            dataIndex: 'departId_dictText',
          },
          {
            title:'项目名称',
            align:"center",
            width:200,
            ellipsis: true,
            dataIndex: 'projectId_dictText',
          },
          {
            title:'采购大类',
            align:"center",
            width:120,
            ellipsis: true,
            dataIndex: 'provisionBroad_dictText',
          },
          {
            title:'业务板块',
            align:"center",
            width:120,
            ellipsis: true,
            dataIndex: 'businessSegment_dictText',
          },
          {
            title:'中标供应商',
            align:"center",
            width:250,
            ellipsis: true,
            dataIndex: 'biddingUnit_dictText',
          },
          {
            title:'中标总金额(元)',
            align:"center",
            width:150,
            ellipsis: true,
            dataIndex: 'bidding',
          }
        ],
        url: {
          list: "/api/erp/purchase/procurement/erpPurchaseCalibrationOpinion/allList",
          exportXlsUrl: "/api/erp/purchase/procurement/erpPurchaseCalibrationOpinion/exportXls"
        },
        dictOptions:{},
        superFieldList:[],
        supplyTime: [],
        calibrationTime: [],
        queryParam: {bpmStatus: '3', billStatus: '1,2'}
      }
    },
    created() {
      this.getSuperFieldList();
    },
    computed: {
      importExcelUrl: function(){
        return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
      },
    },
    methods: {
      //查看详情
      getDetail(id) {
        this.$router.push({
          path: `/erp/purchase/procurement/ErpPurchaseCalibrationOpinionListDetail/${id}`,
        })
      },
      searchReset() {
        this.queryParam = {bpmStatus: '3', billStatus: '1,2'}
        this.loadData(1);
      },
      initDictConfig(){
      },
      getSuperFieldList(){
        let fieldList=[];
        fieldList.push({type:'string',value:'purchaseBill',text:'单据编号',dictCode:''})
        fieldList.push({type:'string',value:'applicant',text:'申请单位',dictCode:''})
        fieldList.push({type:'string',value:'employeeId',text:'申请人',dictCode:''})
        fieldList.push({type:'string',value:'departId',text:'申请部门',dictCode:''})
        fieldList.push({type:'date',value:'supplyTime',text:'工期(供货期)'})
        fieldList.push({type:'date',value:'calibrationTime',text:'开标时间'})
        fieldList.push({type:'BigDecimal',value:'budget',text:'预算价',dictCode:''})
        fieldList.push({type:'string',value:'invoiceManner',text:'开票方式',dictCode:''})
        fieldList.push({type:'Text',value:'quoteDescription',text:'各厂家报价、谈判情况描述及选定该厂家供货的原因：（重点描述品牌、价格对比情况、原厂还是代理商等）',dictCode:''})
        fieldList.push({type:'Text',value:'historyDescription',text:'历史采购情况说明：  （重点描述品牌、价格情况）',dictCode:''})
        fieldList.push({type:'Text',value:'differenceDescription',text:'与采购申请的差异：  （重点描述规格型号、参数及品牌、数量等更改项目）',dictCode:''})
        fieldList.push({type:'Text',value:'opinionDescription',text:'申购单位意见：  （对产品品牌、价格、数量的认可及增减等描述）',dictCode:''})
        fieldList.push({type:'string',value:'remark',text:'备注',dictCode:''})
        fieldList.push({type:'string',value:'purchaseFile',text:'附件信息',dictCode:''})
        fieldList.push({type:'string',value:'bpmStatus',text:'流程状态',dictCode:''})
        fieldList.push({type:'int',value:'checkStatus',text:'流程审批结果',dictCode:''})
        this.superFieldList = fieldList
      }
    }
  }
</script>
<style scoped>
  @import '~@assets/less/common.less';
</style>
